package com.pope945.mypanel;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.jdesktop.application.Application;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Background extends JFrame {
	private JButton jButton1;
	public Background() {
		BackPanel p = new BackPanel();
		getContentPane().add(p);
		JPanel conP = new JPanel();
		conP.setOpaque(false);
		p.setLayout(new BorderLayout());
		p.add("Center", conP);
		JLabel label = new JLabel("Background   example");
		label.setForeground(Color.white);
		label.setOpaque(false);
		conP.add(label);
		{
			jButton1 = new JButton();
			conP.add(jButton1);
			jButton1.setName("jButton1");
		}

		setSize(800, 600);
		setVisible(true);
		Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(getContentPane());
	}

	/**   
	 *   @param   args   
	 */
	public static void main(String[] args) {
		//   TODO   Auto-generated   method   stub   
		new Background();
	}

}

class BackPanel extends JPanel {

	protected void paintComponent(Graphics g) {
		//   TODO   Auto-generated   method   stub   
		super.paintComponent(g);
		Image img = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Icon/background.jpg"));
		
		g.drawImage(img, 0, 0, null, this);
	}

}
